#!/bin/bash
# 检查脑裂的脚本，在备节点上进行部署
LB01_VIP=192.168.1.100
LB01_IP=192.168.1.98
LB02_IP=192.168.1.92
flag=0
while true
do
  ping -c 2 -W 3 $LB01_VIP &>/dev/null
    if [ $? -eq 0 -a `ip add|grep "$LB01_VIP"|wc -l` -eq 1  ];then
        if [ $flag -lt 10  ];then
        echo  "ha is brain." | mail -s "测试环境 keepalive的vip   ha is brain. $LB01_VIP  $LB02_IP" lijinl@126.com
        ((flag++))
        fi
    else
       flag=0
       # echo "ha is ok"
       continue
    fi
    sleep 5
done
